/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cjava.system.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author user
 */
@Entity
@Table(name = "meeting_business_associate", catalog = "socioscjava", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MeetingBusinessAssociate.findAll", query = "SELECT m FROM MeetingBusinessAssociate m")})
public class MeetingBusinessAssociate implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "coming_in")
    @Temporal(TemporalType.TIMESTAMP)
    private Date comingIn;
    @Column(name = "assistance")
    private Boolean assistance;
    @JoinColumn(name = "id_meeting", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Meeting idMeeting;
    @JoinColumn(name = "id_business_associate", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private BusinessAssociate idBusinessAssociate;

    public MeetingBusinessAssociate() {
    }

    public MeetingBusinessAssociate(Integer id) {
        this.id = id;
    }

    public MeetingBusinessAssociate(Integer id, Date comingIn) {
        this.id = id;
        this.comingIn = comingIn;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getComingIn() {
        return comingIn;
    }

    public void setComingIn(Date comingIn) {
        this.comingIn = comingIn;
    }

    public Boolean isAssistance() {
        return assistance;
    }

    @Transient
    public boolean getAssistan() {
        return assistance;
    }
    
    public void setAssistance(Boolean assistance) {
        this.assistance = assistance;
    }

    public Meeting getIdMeeting() {
        return idMeeting;
    }

    public void setIdMeeting(Meeting idMeeting) {
        this.idMeeting = idMeeting;
    }

    public BusinessAssociate getIdBusinessAssociate() {
        return idBusinessAssociate;
    }

    public void setIdBusinessAssociate(BusinessAssociate idBusinessAssociate) {
        this.idBusinessAssociate = idBusinessAssociate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MeetingBusinessAssociate)) {
            return false;
        }
        MeetingBusinessAssociate other = (MeetingBusinessAssociate) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cjava.system.model.MeetingBusinessAssociate[ id=" + id + " ]";
    }
    
}
